package com.yy.mapper;

import com.yy.pojo.Collection;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CollectionMapper{
    @Insert("insert into collection(user_id,article_id) values (#{userId},#{articleId})")
    Integer insert(Integer userId, Integer articleId);

    @Select("select * from collection where user_id=#{userId} and article_id=#{articleId}")
    Collection selectByUserIdAndArticleId(Integer userId, Integer articleId);

    @Delete("delete from collection where collection_id=#{collectionId}")
    Integer deleteById(Integer collectionId);

    @Select("select * from collection where user_id= #{userId}")
    List<Collection> selectByUserId(Integer userId);
}
